from lib.sys.logger_factory import LoggerFactory
from crawler_core.driver.driver_proxy import DriverProxy
from crawler_core.exception.aoount_exec import AccountException
from crawler_core.exception.vertify_exec import VertifyException
from login_server.interface_login import LoginInterface


class LoginDajie(LoginInterface):
    logger = LoggerFactory.getLogger("LoginDajie", "login")

    def __init__(self):
        pass

    def login(self, context):
        self.driver = DriverProxy().get()

        if self.driver:
            try:
                cookies = {}
            except VertifyException:
                raise VertifyException()
            except AccountException:
                raise AccountException()
            finally:
                self.driver.close()
        return cookies
